import React from 'react';
import styled from 'styled-components';
import { useGame } from '../context/GameContext';

const ScoreContainer = styled.div`
  position: absolute;
  top: 20px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 10;
`;

const ScoreText = styled.p`
  margin: 5px 0;
  font-size: 1.2rem;
  color: #333;
  display: flex;
  justify-content: space-between;
  min-width: 150px;

  span {
    font-weight: bold;
    color: #ff1493;
  }
`;

const Divider = styled.hr`
  border: none;
  border-top: 1px solid #ddd;
  margin: 10px 0;
`;

const ScoreBoard: React.FC = () => {
  const { state } = useGame();

  return (
    <ScoreContainer>
      {state.mode === 'couple' ? (
        <>
          <ScoreText>
            玩家1: <span>{state.score.player1}</span>
          </ScoreText>
          <Divider />
          <ScoreText>
            玩家2: <span>{state.score.player2}</span>
          </ScoreText>
        </>
      ) : (
        <>
          <ScoreText>
            得分: <span>{state.score.player1}</span>
          </ScoreText>
          <Divider />
          <ScoreText>
            最高分: <span>{state.highScore}</span>
          </ScoreText>
        </>
      )}
    </ScoreContainer>
  );
};

export default ScoreBoard; 